<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>易买网 - 首页</title>
<link type="text/css" rel="stylesheet" href="../../statics/css/style.css" />
<script type="text/javascript" src="../../statics/scripts/function.js"></script>
</head>
<body>
<div id="header" class="wrap">
	<input type="hidden" id="pageIndex" value="1"/>
	<input type="hidden" id="totalPage" value=""/>
	<div id="logo"><img src="images/logo.gif" /></div>
	<div class="help"><a href="#" class="shopping">购物车</a><a href="login.html">登录</a><a href="register.html">注册</a><a href="guestbook.html">留言</a></div>
	<div class="navbar">
		<ul class="clearfix">
			<li class="current"><a href="#">首页</a></li>
			<li><a href="#">图书</a></li>
			<li><a href="#">百货</a></li>
			<li><a href="#">品牌</a></li>
			<li><a href="#">促销</a></li>
		</ul>
	</div>
</div>
<div id="childNav">
	<div class="wrap">
		<ul class="clearfix">
			<li class="first"><a href="#">音乐</a></li>
			<li><a href="#">影视</a></li>
			<li><a href="#">少儿</a></li>
			<li><a href="#">动漫</a></li>
			<li><a href="#">小说</a></li>
			<li><a href="#">外语</a></li>
			<li><a href="#">数码相机</a></li>
			<li><a href="#">笔记本</a></li>
			<li><a href="#">羽绒服</a></li>
			<li><a href="#">秋冬靴</a></li>
			<li><a href="#">运动鞋</a></li>
			<li><a href="#">美容护肤</a></li>
			<li><a href="#">家纺用品</a></li>
			<li><a href="#">婴幼奶粉</a></li>
			<li><a href="#">饰品</a></li>
			<li class="last"><a href="#">Investor Relations</a></li>
		</ul>
	</div>
</div>
<div id="position" class="wrap">
	您现在的位置：<a href="index.html">易买网</a> &gt; <a href="product-list.html">图书音像</a> &gt; 图书
</div>
<div id="main" class="wrap">
	<div class="lefter">
		<div class="box">
			<h2>商品分类</h2>
			<dl>
				<dt>图书音像</dt>
				<dd><a href="product-list.html">图书</a></dd>
				<dd><a href="product-list.html">音乐</a></dd>
				<dt>百货</dt>
				<dd><a href="product-list.html">运动健康</a></dd>
				<dd><a href="product-list.html">服装</a></dd>
				<dd><a href="product-list.html">家居</a></dd>
				<dd><a href="product-list.html">美妆</a></dd>
				<dd><a href="product-list.html">母婴</a></dd>
				<dd><a href="product-list.html">食品</a></dd>
				<dd><a href="product-list.html">手机数码</a></dd>
				<dd><a href="product-list.html">家具首饰</a></dd>
				<dd><a href="product-list.html">手表饰品</a></dd>
				<dd><a href="product-list.html">鞋包</a></dd>
				<dd><a href="product-list.html">家电</a></dd>
				<dd><a href="product-list.html">电脑办公</a></dd>
				<dd><a href="product-list.html">玩具文具</a></dd>
				<dd><a href="product-list.html">汽车用品</a></dd>
			</dl>
		</div>
		<div class="spacer"></div>
		<div class="last-view">
			<h2>最近浏览</h2>
			<dl class="clearfix">
				<dt><img src="images/product/0_tiny.gif" /></dt>
				<dd><a href="product-view.html">法国德菲丝松露精品巧克力500g/盒</a></dd>
				<dt><img src="images/product/0_tiny.gif" /></dt>
				<dd><a href="product-view.html">法国德菲丝松露精品巧克力500g/盒</a></dd>
			</dl>
			<script type="text/javascript">
				document.write("Cookie中记录的购物车商品ID："+ getCookie("product") + "，可以在动态页面中进行读取");
			</script>
		</div>
	</div>
	<div class="main">
		<div class="product-list">
			<h2>全部商品</h2>
			<div class="pager">
				<ul class="clearfix">
					<li><a href="#">上一页</a></li>
					<li class="current">1</li>
					<li><a href="#">2</a></li>
					<li><a href="#">3</a></li>
					<li><a href="#">4</a></li>
					<li><a href="#">5</a></li>
					<li><a href="#">下一页</a></li>
				</ul>
			</div>
			<div class="clear"></div>
			<ul class="product clearfix">
				
			</ul>
			<div class="clear"></div>
			<div class="pager">
				<ul class="clearfix">
					<li><a href="javascript:page(1)">上一页</a></li>
					<li class="current" href="" onclick="skip()">1</li>
					<li><a href="javascript:skip()">2</a></li>
					<li><a href="javascript:skip()">3</a></li>
					<li><a href="javascript:skip()">4</a></li>
					<li><a href="javascript:skip()">5</a></li>
					<li><a href="javascript:page(2)">下一页</a></li>
				</ul>
			</div>
		</div>
	</div>
	<div class="clear"></div>
</div>
<div id="footer">
	Copyright &copy; 2010 北大青鸟 All Rights Reserved. 京ICP证1000001号
</div>
</body>
</html>
<script src="../../statics/scripts/jquery.js"></script>
<script>
	var url = decodeURI(location.search);
	var epcChildId = url.substr(12);
	var pathName = document.location.pathname;
	var index = pathName.substr(1).indexOf("/");
	var result = pathName.substr(0,index+1);
	$(function(){
		
		getProductList(epcChildId,"","");
		
	})	
	function getProductList(epcChildId,pageIndex,pageSize){
			$.ajax({
				url:result+"/pro/List",
				dataType:"json",
				data:"epcChildId="+epcChildId+"&pageIndex="+pageIndex+"&pageSize="+pageSize,
				Type:"get",
				success:function(data){
					if(data.success){
						gender(data.data);
						$("#pageIndex").val(data.pageIndex);
						$("#totalPage").val(data.totalPage);
					}else{
						alert(data.message);
					}
				},
				error:function(){
					alert("请求响应出错");
				}
			})
		}
		
		
		function gender(data){
		$(".product-list>ul").html("");
		for(var i=0;i<data.length;i++){
			var str = "<li><dl><dt><a href='product-view.html?epId="+data[i].epId+"' target='_blank'><img src='../../statics/images/product/"+data[i].epFileName+"' /></a></dt><dd class='title'><a href='product-view.html?epId="+data[i].epId+"' target='_blank'>"+data[i].epName+"</a></dd><dd class='price'>￥"+data[i].epPrice+"</dd></dl></li>";
			$(".product-list>ul").append(str);
		}				
	}
	
	function page(data){
		var pageIndex = $("#pageIndex").val();
		var totalPage = $("#totalPage").val();
		var _pageIndex = parseInt(pageIndex);
		var _totalPage = parseInt(totalPage);
		switch(data){
			case 1:
				if(_pageIndex-1<1){
					getProductList(epcChildId,1,8);
				}else{
					getProductList(epcChildId,_pageIndex-1,8);
				}
				break;
			case 2:
				if(_pageIndex+1>_totalPage){
					getProductList(epcChildId,1,8);
				}else{
					getProductList(epcChildId,_pageIndex+1,8);
				}
				break;
		}
	}
	
	function skip(){
		
	}

</script>